#ifndef HARUSTYLE_H
#define HARUSTYLE_H

#include <QCommonStyle>

/*!
 * \brief The HaruStyle class provides the QStyle of the entire framework.
 */
class HaruStyle : public QCommonStyle
{
public:
    static HaruStyle *instance();

    static void initial();

    ~HaruStyle() override;

    void drawComplexControl(QStyle::ComplexControl cc,
                            const QStyleOptionComplex *opt,
                            QPainter *p,
                            const QWidget *widget = nullptr) const override;

    void drawControl(QStyle::ControlElement element,
                     const QStyleOption *opt, QPainter *p,
                     const QWidget *widget = nullptr) const override;

    void drawPrimitive(QStyle::PrimitiveElement pe,
                       const QStyleOption *opt, QPainter *p,
                       const QWidget *widget = nullptr) const override;

    QPixmap generatedIconPixmap(QIcon::Mode iconMode,
                                const QPixmap &pixmap,
                                const QStyleOption *opt) const override;

    QStyle::SubControl hitTestComplexControl(QStyle::ComplexControl cc,
                                             const QStyleOptionComplex *opt,
                                             const QPoint &pt,
                                             const QWidget *widget = nullptr) const override;

    int layoutSpacing(QSizePolicy::ControlType control1,
                      QSizePolicy::ControlType control2,
                      Qt::Orientation orientation,
                      const QStyleOption *option = nullptr,
                      const QWidget *widget = nullptr) const override;

    int pixelMetric(QStyle::PixelMetric m,
                    const QStyleOption *opt = nullptr,
                    const QWidget *widget = nullptr) const override;

    void polish(QPalette &pal) override;
    void polish(QApplication *app) override;
    void polish(QWidget *widget) override;

    QSize sizeFromContents(QStyle::ContentsType ct,
                           const QStyleOption *opt,
                           const QSize &csz,
                           const QWidget *widget = nullptr) const override;

    QPixmap standardPixmap(QStyle::StandardPixmap sp,
                           const QStyleOption *option = nullptr,
                           const QWidget *widget = nullptr) const override;

    int styleHint(QStyle::StyleHint sh,
                  const QStyleOption *opt = nullptr,
                  const QWidget *widget = nullptr,
                  QStyleHintReturn *hret = nullptr) const override;

    QRect subControlRect(QStyle::ComplexControl cc,
                         const QStyleOptionComplex *opt,
                         QStyle::SubControl sc,
                         const QWidget *widget = nullptr) const override;
    QRect subElementRect(QStyle::SubElement sr, const QStyleOption *opt,
                         const QWidget *widget = nullptr) const override;

    void unpolish(QWidget *widget) override;
    void unpolish(QApplication *application) override;


private:
    static HaruStyle *inst;
    HaruStyle();
    QStyle *m_style;
};

#endif // HARUSTYLE_H
